using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using TagTool.Devices;

namespace TagTool.Devices.Midi
{
	public abstract class MidiDevice : IMidiDevice
    {
        protected IntPtr deviceHandle;
        protected MidiDeviceType type;
        protected uint deviceId;
        protected string name;
		protected bool connected;

		public MidiDevice(uint deviceId)
        {
            this.deviceId = deviceId;
            GetDevCaps();
        }

        ~MidiDevice()
        {
        	Disconnect();
        }

        #region Properties

        public virtual MidiDeviceType Type
        {
            get
            {
                return type;
            }
        }
        
        public virtual string Name
        {
        	get { return name; }
        }

        public virtual int DeviceId
        {
        	get { return (int)deviceId; }
        }

        public virtual bool Connected
        {
        	get { return connected; }
        }

        public virtual bool Available
        {
        	get { return false; }
        }

        #endregion
        
        #region Methods
        
        public abstract void Connect();
        public abstract void Disconnect();
        public abstract MMResult GetDevCaps();

        #endregion Methods
    }
}
